package com.controller;


import com.entity.OperateLogEntity;
import com.entity.vo.OperateLogExcelVO;
import com.entity.vo.ZhongbiaogonggaoExcelVO;
import com.service.ExcelService;
import com.utils.ExportUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.annotation.IgnoreAuth;

/**
 * Excel导出 前端控制器
 * Copyright(c)2016-2022, 贵阳巴士快运旅游有限公司
 * 项目名称: 黔爽巴士
 * Author:suxu (zsx317127523@163.com)
 */
@Slf4j
@RestController
@RequestMapping("excel")
public class ExcelController {

    @Autowired
    private ExcelService excelService;

    @IgnoreAuth
    @RequestMapping(value = "/operatelog", method = RequestMethod.GET)
    public void exportOperatelog(HttpServletResponse response, @RequestParam Map<String, Object> params)  throws IOException{
        List<OperateLogExcelVO> list = excelService.exportOperateLog(params);
        String fileName = "操作日志数据_";
        ExportUtil.writeExcel(response,list,OperateLogExcelVO.class,fileName);
    }

    @IgnoreAuth
    @RequestMapping(value = "/zhongbiaoExcel", method = RequestMethod.GET)
    public void exportZhongbiaoExcel(HttpServletResponse response, @RequestParam Map<String, Object> params)  throws IOException{
        List<ZhongbiaogonggaoExcelVO> list = excelService.exportZhongbiaoExcel(params);
        String fileName = "中标数据_";
        ExportUtil.writeExcel(response,list,ZhongbiaogonggaoExcelVO.class,fileName);
    }
}



